﻿<%@ Page Language="VB" AutoEventWireup="false" CodeFile="control.aspx.vb" Inherits="control" %>
<%@ Import Namespace="System.Xml" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Control Page</title>
</head>
<body>


<%
Response.Buffer = False
‘ensure proper headers sent to the client
Response.ContentType = “text/xml”
%>
<?xml version=”1.0″?>
<%

    'these are our variables
    Dim objXML, objNews As Object
    
    'create an instance of the DOM
    objXML = Server.CreateObject("Microsoft.XMLDOM")
    
    'Create our root element using the createElement method
    objXML.documentElement = objXML.createElement("news")
    
    'Create the newsitem element
    objNews = objXML.createElement("newsitem")
    
    'now we will create all the child elements in this case
    'title , link and description
    objNews.appendChild(objXML.createElement("title"))
    objNews.appendChild(objXML.createElement("link"))
    objNews.appendChild(objXML.createElement("description"))
    
    'now we add values to the child elements
    objNews.childNodes(0).text = "programmingsite.co.uk"
    objNews.childNodes(1).text = "http://www.programmingsite.co.uk"
    objNews.childNodes(2).text = "programming resources"
    
    'add the newsitem element to the news element
    objXML.documentElement.appendChild(objNews.cloneNode(True))
    'write the document using the xml method of the DOM
    Response.Write(objXML.xml)
    
%>

</body>
</html>
